add error handling to mm_real routines