remove useless mime check, and some refactor