Fix deletion corner case & set correct error codes
Merge branch 'master' of github.com:flack/midgard-portable