fixing A LOT of bugs