Improved error reporting in common.R