fixing model logic