fixed math a little bit