Solution to 500 error due to no connection established