Fixing bug in return value comparison in stop() function