Fix andrew hull algo and add test