fixed json error and created a new exception handler