massive fix on several models, added a check to know if the $result is an object or not