various bug fixes found while compiling