add null check in markChunkModified