fix errors pointed out by @fyockm