rewrite binlog helper functions