Fix errors pointed out by @mgold