Fixes fragment encoding and closes #6455