Fixed somes bugs