fixes few bugs