Core: Logical fixes and improvements in EventMap
Merge pull request #7873 from Gacko/eventphases

Core: Logical fixes in EventMap
Core: Fix warnings