#199 fixed issue with returning errors to application/json requests