Set the right  extension for the file