fixed major bugs