addes Leap support, fix some bugs