fixed bugs within last 2 commits