fixing memory leak this time