fixed all functions