Fixed NullPointerException in copying files