Bug fix: only shelve on demand