Fix bug when listing messages in api

https://assemblymade.com/helpful/wips/402