Fixing some last bugs