improved gii input filter, fixes #3689