Added NULL handling.