Fixes get nearest skeleton algorithm