[#306] fixed crash on swapped parameter order with sanity check.

placing sanity checks like this is a good way to bloat the code. See #308 for a plan to improve the error reporting system