added autocommit but still TypeError at line 51