- code beautification - tabs versus spaces / identation
- removed unused variable
 - normalize some debug logs
- partial porting of merge 50117f (adapted to 1.8)