fix element detection