improve filtering in register.pl.