Fix NoneType error when creating router