move echo inside if