Some changes from oyo-hack/qi:master

https://gitorious.org/oyo-hack/qi/commits/4e5d46affe909f9f331f05eff1c00d7b1c06f173?page=3