error raporting and bug fix