removed CRLF characters, throwing exception if mode is not configured properly