Changed the logger and try to debug as_polynomial