fixed some errors, handles failing out