fix lua building issues, mac os x improvements