some bugfixes and added register template