Fixed a bug in task 4