Fix for bug #41 in both cookie and localStorage cases by removing if nul...

...l is passed in as a value

Alternative to the pull request proposed by javaguirre