fixed bugs #108, #111 & #114