Fixed bug setting default values to values that are falsy
Check for undefined value rather than typeof 'undefined'