fixed bugs task3 add task4

fixed bugs.
add task 4.