correct a few bugs