Fix issues importing projects from EE to CE. Also added relevant spec.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/18957