bug fixes

I'll try to make sure i ddn't brak anythng else before merging with
master