fixing minor bugs

looking for any memory leaks