Fixes both 'type' is null and 'regexCache' is null 

Hello!

This pull request fixes two issues for MSIE8 (and possibly others):

* *'type' is null or not an object* - Issue #9 
* *'regexCache' is null or not an object* - this seem to be specific MSIE8 behaviour (it does not allow closure var declaration between function bodies???)