fix classcast bug when resource does not support mkcol
Merge origin/master
fix for temp file not being deleted