Add new code to manage 500 server error