chmod(), chown() and chgrp() must consider permissions of directory where file/directory is inside, fixes #52