Fixed problem with NaNs :)