fix bugs in release mode