fixed bugs about msgtype in custom.rb
clean codes