Fixes for undefined var checks