Replace exit() with error return.