fix regexp in  writeLayer