https://issues.apache.org/jira/browse/EXTSCRIPT-127 fixed, added null checks in front of every type conversion just to make sure that the code does not trigger an npe (better to have a lost dependency than an npe)