Temporary fix to make space function safer