Ported a few fixes from shoguns version of tapkee