a number of bugs fixed