use fd as index