Fixed IndexOutOfBoundException in EntityListener