Improve error handling; Send response in correct format [MJ-212]