small bug fixes

r.remove() -> removeChild