Make selection updating work properly