Fixed some unexpected behaviors.