Added safety checks for Metrics initialization