Correct double/int mistakes, testing of nan and preprocessings,