fixes for offer template rest and db's table relations