improved checkContentType header and some other helper improvements