sort message keys
fix positioning bug