FIXED CRITICAL BUG BEFORE SUBMITTING ASSIGNMENT 5