Fix https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10602#note_27871752
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/30637