World number four Agnieszka Radwanska was made to work hard before moving into the last 16 of the Sony Open in Miami.