Fixed rather large bug