error trapping for future debugging