Fix bugs

#19, #21, #22