updates: fixed some memory problems