fixing the index statement for messages