remove undefined when not defined