fix moving/resizing buggyness
added some comments