In short: syntax checking in general will be improved in 4.50.

This particular issue (regarding 'stray' ENDFUNCTIONs) will be fixed in the next build of 4.21.

Thanks for the report!

Ruud