fix #122 #123 #131
Merge pull request #153 from nucleic/fix-131

fix #122 #123 #131