fix issue with db query
update
append api error handler