Fix the argument check in flatten() function [needs test]

flatten() only uses the first argument, so raise an error with
too few arguments *and* with too many arguments.