Fix memory bug with shadowmap