fix all the warnings Tim's bad code introduced