Fix issues #16 & #30