more style consistency and bug fixes