Merge branch 'bugfix_kitty' into upstream-4.0-stable
Fix error handling
Merge branch 'bugfix_chmod' into upstream-master