removed small bug, and some superfluous fprintf statements