Use the proper object types when querying last modified, fixes #1189