correctly assign array values

correctly removes tmp directory after building