some simulation bugs fixed