added support for handling blockchain reorganization