fixed usage of .apply