Add undefined/null parameter handling and corresponding test cases.