Fix issues #13, #21