fix array bound issue