Fix a slow of minor bugs and warning issues that show up when building with -O2

Signed-off-by: Olaf Kirch <okir@suse.de>