Bug fix caused by optimisation