implementation see #317