fixed login and added script_lib in template for one time script loading