fix key issues (move from arrays to objects)