M/arithmetic fixes

and improved error messages etc.