Minor fixes for unset vars and indices

To make it possible to run the plugin with `WP_DEBUG` and PHP Error notices enabled, some changes need to be made.