Fixed getAdvice bug occurring with boundary cases