ignore undefined params when not required

When scope var is an empty string the parameter is removed from search, making them undefined, which should not cause the scope variable to become undefined.