Added check for piping to undefined