fixed the last few bugs