Fixed improperly written pinvokes
If logging functions are called before BPS is initialized, then init logging manually.