 
 			# the higher this number, the better
 			vp.layer_pos.estate = vp.layer_pos.width * vp.layer_pos.height
-			vp.layer_pos.aspect_ratio = vp.layer_pos.width / vp.layer_pos.height
-			vp.dim_layer.aspect_ratio = vp.dim_layer.borderBoxWidth / vp.dim_layer.borderBoxHeight
+			vp.layer_pos.aspect_ratio = (vp.layer_pos.width or 1) / (vp.layer_pos.height or 1)
+			vp.dim_layer.aspect_ratio = (vp.dim_layer.borderBoxWidth or 1) / (vp.dim_layer.borderBoxHeight or 1)
 
 			wanted_rank = (allowed_placements.length - CUI.util.idxInArray(placement, allowed_placements))
 			if wanted_placement == placement

		placement = available_placements[0]

		if ev?.hasModifierKey()
			console.debug "layer", dim_layer
			console.debug "element", dim_element
			console.debug "pointer", dim_pointer

		else
			CUI.dom.setStyleOne(@__layer_root.DOM, "visibility", "hidden")

	__allPlacements: ["s", "e", "w", "ws", "wn", "n", "se", "ne", "es", "en", "nw", "sw", "c"]

	knownPlacements: ["s", "e", "w", "ws", "wn", "n", "se", "ne", "es", "en", "nw", "sw", "c"]

	__setElement: (element) ->
