fix bar calculation and grid appearance