Ported to kohana 3.3.2