who wrote just when i needed you most