fixed crashes

a. file has no extension
b. while opening a file