Merge pull request #439 from git-harry/sprint

Merged automatically by jenkins after successful gate test
Tidy up how invalid ids are handled.