[misc] Bulletproofing
[cleanup] Applied codestyle
[misc] Better fix for #918