Finally fixed a couple of persistent bugs