fix bugs on margin