Return correct exit code even if -q (quiet) is used. Closes #786