fixed bug with wrong extension

wrong extension was being chosen when arguments were present.