working XS version, but still leaks