Fixed the lastModified check
Added test cases