Fixes #3067 Fixed user foreignKey handling