Fixed bug in LastModified and improvement in error handling