Fixed demotion bugs.