bug removal and modification on error response

Removed one bug caused by queries to table dnrentity.
Modified the format of error response.