Fixed a bug in the solution.