fix bugs in realistic.cpp