fixing another nan bug