fix scan bugs