fix bugs
Handle exeptions
Response error handling in api.py
fix merge conflicts