some fixes for problem 4