Fix Kohana detection logic