Fix errors pointed out by Tony