Added error recording