bug fixes

sorry for all the commits, didn't notice upstream changes some how...