fix -Optimize the code
have a bug