#667950 by merlinofchaos, bojanz and dereine: Revert the states patch and use ctools dependency instead.