Fixes in the shell function
Send proper http errors, remove unused error message