Fixed compilation
Improved OpenKey

Hopefully it won't brake anything....