fixed bug: threw exception when passing null as the second argument