fixed issue that javascript is only executed after reload