fixed the queue implementation and added sync for new files.