reducing error calls to one