497. A Magistrate imposing a fine under this Ordinance may, if he thinks fit, direct the whole or any part thereof to be applied in compensating any person for any detriment which he may have sustained by the act or default in respect of which fine is imposed or in or towards payment of the expenses of the prosecution.