fixed scp
added optimize feature