lots of bug corrected