Fix messages functions for sms