add implementation of issue #548