Bufixes (not tested yet)

Will need to get this onto my device, but wanted to get it through for code review.