Oops. I had two working copies of this file and accidentally pushed the wrong one. The if statements were a tad convoluted, I fixed them and made the error string a bit more specific. See commit 0214b46597240a3592a62cc1e1eb1b24c93f275e