fix data loss and layout problem in gamma;