Merge pull request #114 from teoyaomiqui/master

adding check before writing to core file