Update element height logic