Misc bug fixes, flexible init