bugfixes in the 'exists' implementation

return-code handling was badly implemented