Fixed issues #33, #34, #38