Some tweaks to fix firefox, minor api changes