Merge the bug fixing for #1 and #20

#1
#20