Fixing unbound var bugs