fixing problems on the pattern