Fix .top being called on undefined

This pull request fixes an issue where `dest.top` was being called even when `dest` was undefined.