Fixed a couple of bugs - finding max partition and deleting partition in metadata when deleted from database