Fix #217: throw on invalid function declaration