fixes issues from prev coommit 45ee781

partly resolve #146