See my other comment about definitions inside conditionals.