fix element calculation

relates to #266