Fix index creation when running in safe mode