Fixed a small bug in code