Fix more bugs. Removed warnings