add support for internaldate, properly parse flags