fixed logger
fixed NPEs and logger
more template stuff
fixed logger