Fixed get messages query
Check for existance of includeReceived
Moved options to db