Fixed and improved #x selection operator