fixed up some more code