added check for extension to exist