fix #27, improve #25