Added if test thats quits when dm is too high and gives invalid value (-1e21).