Fixed some more memory issues