Add check for invalid hash keys in generator (for #20)