Stability improvement

This is a follow-up to [7601](https://github.com/gitlabhq/gitlabhq/pull/7601). I'm not sure if there's a possibility of such case, but anyway...