fixing crazy end for error