fixes some bugs in running