Found a bug caused by scope errors