More unit tests and cross browser fixes