Prevented memory leaks