Added wait flags for cache loading, fixed rescan command