Issue #521 - Fix margin bugs