Add support to replay events; other bugfixes;