fixed some book keeping