bug fix and add flip action