Fixes

Patches that improve debugging (by not calling non-existent functions and printing a helpful message) and fix some invalid variable/function references.