Resolving some errors when calculating margin...