Fixed the bug for 1b and 1c