Added a logger that shows error in php://stderr
Also added an extra check to avoid creating multiple instances of the Authentication object