fixed a small bug in main