fixed error handling in rate functions