Solved with a global array added.