fixed a performance bug