added changes from https://github.com/gitlabhq/gitlabhq/issues/2497