fixed some bugs with last commit