partial fix to #305