Fix prepared statements

Spotted while looking at #148.