Optimizing extension checking