Small fix from Tom Jansen <tom@ninja.nl> to check correct error return.