made it so it recalculates if it gets an error