Fixing getRootMessages method