add some fixes from Zack Lym