added file exists check with in place exception for more stability