Added checks to make sure prerequisite stages in pipeline actually exist...

... so that deep recursion of the sub_pipeline() does not occur and run berlin out of memory if someone enters a bad pipeline definition.