test in real env, fix many bugs; TODO: fix bugs...