Fix bug detecting and sending content type