Use project metadata to find parent

Fix checking for manually/differently created staging projects.