Fix for incorrectly choosing project

When projects are deleted we cannot rely on the index, so use the
Project ID instead