Fix crash with forward declarations.

Thanks to Alok Singhal.