errorcheck and bugfix