       coords.y <= @gridHeight*@size
 
   @getGridCoordinates = (coords) ->
-    new Coordinate Math.floor(coords.x/@size), Math.floor(coords.y/@size)
+    new Coordinate Math.floor(coords.x/@size), Math.floor((coords.y-2)/@size) #because the two pix thick line -2
 
   @getCanvasCoordinates = (coords) ->
     new Coordinate Math.floor(coords.x*@size), Math.floor(coords.y*@size)

      else if event.which == 3 && objOnPos != false
        @deleteObjectWithIndex @objects.indexOf(objOnPos)

  @onMouseUp = (event) =>
    @mousePressed = false
    coords = @getGridCoordinates @getMousePos(event)

    mousPos = @getMousePos event
    pos = @getGridCoordinates mousPos
    objOnPos = @isSomethingOnPosition pos.x, pos.y
    if !Simulation.isSimulating && objOnPos == false && @mousePressed == 1 && @contains(@getMousePos(event))
      @GridControls.creatObjectFromButton pos.x, pos.y
    else if @mousePressed == 3 && objOnPos != false
      @deleteObjectWithIndex @objects.indexOf(objOnPos)
