Fix scan_keys method