fixed error after running Valgrind