Properly return http response, improve error messages, avoid dangerous file deletion bug - JJW