improved result code check to work on windows