fixed bugs, misc tweaks