Fixes grid padding/horizonta/vertical spacing calculation