implemented properly mime handling