fix cannot read property 'charAt' of null

Fixes issue when setting a default param as `null` error `TypeError: Cannot read property 'charAt' of null`