diff --git a/engines/sci/util.h b/engines/sci/util.h
index 333d849..5c880d3 100644
--- a/engines/sci/util.h
+++ b/engines/sci/util.h
@@ -363,6 +363,17 @@ enum SpanDispose {
 
 #define kSpanMaxSize ((uint32)-1)
 
+template <class T>
+struct RemoveConst
+{
+	typedef T type;
+};
+template <class T>
+struct RemoveConst<const T>
+{
+	typedef T type;
+};
+
 /**
  * Bounds-checked, read-write, random-access to raw memory. By default,
  * ownership of the memory passed to the constructor remains with the caller,
@@ -463,10 +474,10 @@ public:
 	/**
 	 * Allocates and fills new memory with a new copy of this Span.
 	 */
-	inline Span makeCopy() const {
-		void *buffer = malloc(byteSize());
+	inline Span<typename RemoveConst<ValueType>::type> makeCopy() const {
+		typename RemoveConst<ValueType>::type *buffer = (typename RemoveConst<ValueType>::type *)malloc(byteSize());
 		memcpy(buffer, data, byteSize());
-		return Span((value_type *)buffer, _size, _sourceName, _sourceByteOffset, kSpanDisposeMalloc);
+		return Span<typename RemoveConst<ValueType>::type>((value_type *)buffer, _size, _sourceName, _sourceByteOffset, kSpanDisposeMalloc);
 	}
 
 	/**
@@ -729,10 +740,10 @@ public:
 	inline SciSpan(const SciSpan<OtherValueType> &other) : Span<value_type>(other) {}
 
 	// TODO: Is there a way to not duplicate this code by reusing what is in Span<T>?
-	inline SciSpan makeCopy() const {
-		void *buffer = malloc(this->byteSize());
+	inline SciSpan<typename RemoveConst<ValueType>::type> makeCopy() const {
+		typename RemoveConst<ValueType>::type *buffer = (typename RemoveConst<ValueType>::type *)malloc(this->byteSize());
 		memcpy(buffer, this->data, this->byteSize());
-		return SciSpan((value_type *)buffer, this->_size, this->_sourceName, this->_sourceByteOffset, kSpanDisposeMalloc);
+		return SciSpan<typename RemoveConst<ValueType>::type>(buffer, this->_size, this->_sourceName, this->_sourceByteOffset, kSpanDisposeMalloc);
 	}
 
 	// TODO: Is there a way to not duplicate this code by reusing what is in
