clean up code

fix a 500 error