improved bouncing behavior to match the java version more closely, see #109