Changed _log() into wlog()
Bugfixes and perl critic changes