Handle NameError exception as bad request
Remove unless assignments