add error handler
fix relation for query