merge from master. fix bugs