Updated and fixed some bugs in the read:message function