Changed the way the mime-type is determined