[Buildable] Fix some bugs

1. Corner selection bug
2. Memory leak bug