fixing bugs + testing