fix element calculation