fixed crash when dragging while no image loaded, fixed issue #2, fixed issue #9