Fixes #5 — robust error-checking for the concatenate function