fix app context bugs
add error handler order