several bugs removed