fixes kill cells method by introducing a temp array