add checkSelection function to core/cmd.py.