Federer saves two match points to beat Berdych in Miami