added resource to last_error function