fix some bugs
 - server encountered an unexpected error then return 500 by default