Fixed couple bugs