fix assert() error, some small changes