Fixing a small bug in the main function.