change in error reporting so it can be caught via xpcall