remove undefined r