Updated retrieval of file mod time and bug with error check