Fixes thanks to Mike H.