fix pass ... add NULL check and fix variable name