fix bug 2
optimization