fix equals method
fix findbugs warnings
fix #3 ; added mkdir and encoding