Fixes possible memoryleak