Some fixes related to #142