Fix for random 500 bug