Fix issue with parsed statement cache timing - closes #665