resolving error 500 on refresh