fixes error loop