Fixes the selection bugs