Still more bugfixes and added w3c tests