Update file detection regexp
Update image copy function