Pulling JesusFreke's changes (bring master to 2.0.1)