Fix id validation middleware