added extension checking