Even more bug fixes

Courtesy of your friendly neighborhood Tristan