Fix issues #254 #255 #256 #257