little bit of logging and bug fixing