XD-1177: more error checking around labels and indexed modules

Fix for https://jira.springsource.org/browse/XD-1177