fixed a bug with fd 0