the magistrate may order such goods or chattels to be delivered to the owner or to the person entitled to the possession of such goods or chattels either absolutely or upon tender of such amount as may appear to the magistrate to be due from the owner or the person entitled to the possession of such goods or chattels, or upon the performance, or upon the tender and refusal of the performance, of the act for the performance, of which such goods or chattels may have been detained as security, or if such act cannot be performed, then upon tender of compensation for non-performance.