Fixed couple of bug