fixed lots of bugs!