Fixed several compilation issues