fixing horrific bugs