Fix route function