bugfix: message order
support gcm
refactoring