This patches are ripped from OE and Yuri Vasilevski
