A lot of bug corrections