Fix mutation observer implementation for library agnostic code