corrected a few bugs