Fixed issues #55 and #57 and added more debugging code. Sorry for
messing with your plugin, riddle asked me because he was in a hurry.