fixed typo of function calculateDistance

fixed local images path (fixes #1)
added null check (fixes #5)