fixed #316 #317 #314 #310 #307 #298