Fixed Bug Reports #4201, #4079

See: http://dev.kohanaframework.org/issues/4201
See: http://dev.kohanaframework.org/issues/4079