Prevent assertion failure. Fix #775