It was unpredictable magic, but apparently bore some vague relationship to what he was wishing for.
The magic was unpredictable but sort of worked the way he wanted.
These are addressing a wide range of needs of the poor, including access to jobs, education, shelter and personal safety.