Fix maze gen crash bug