Fix for Problem 6 in general