Fix custom user model admin

rebase of #3377
fixes #3377