Fix weird files extension retrieval