fixed up some code