Add debug log
Add a error check and response