fixed some leaks by replacing some calls to unref() with calls to drop()