removing undef values before realising them