fixed somes bugs