Fix dialyzer errors in connect
Fix ensure_indexes