cleanup and fix contentType for ajax requests