fix where clause in dynamic routes