Apply fixes suggested by @rustyfausak