add directory backup and fix some issues