fix nan and make sure everything is good