Fix for adding files faster and rmeoving lock file in scheduled tasks