Fixed up some bugs.