added 400 and 500 error check back