fixed up coding bugs