Serena shakes off ankle injury to reach quarters