Fix for structure pattern calculation