various bug fixes

Just some bugs being fixed