fixed bugs and added copy script for convenience