update to ensure file processing is complete before passing callback