bug fixes, and add a file preview