Added error messages to access_mem()