lot of bug corrections