fixed horrible bugs