small bugs caught by mwl fixed