functions rename and bugfix