fixing first function