Patch to fix segv from Tomas Heredia <tomas@intermediasp.com>