Improved checking undefined and null for parameters