Properly check ids before routing