A fix to the build and the jump-to-definition feature. Fixes #544, fixes #633

Fixes #544, fixes #633
BTW, is there any way to write a test for this?