Fixed a bug in the program